# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Simon Ser <contact@emersion.fr>

# Enable checks in next release when edid-decode is not required for tests:
# https://gitlab.freedesktop.org/emersion/libdisplay-info/-/issues/35
BUILDENV+=(!check)

pkgname=libdisplay-info
pkgver=0.1.1
pkgrel=3
pkgdesc='EDID and DisplayID library'
url="https://gitlab.freedesktop.org/emersion/$pkgname"
arch=(loong64 x86_64)
license=(MIT)
depends=(glibc)
makedepends=(hwdata
             meson
             ninja
             python)
provides=(libdisplay-info.so)
_archive="$pkgname-$pkgver"
source=("$url/-/releases/$pkgver/downloads/$_archive.tar.xz"{,.sig})
sha256sums=('0d8731588e9f82a9cac96324a3d7c82e2ba5b1b5e006143fefe692c74069fb60'
            'SKIP')
validpgpkeys=('34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48')

build() {
	arch-meson "$_archive" build
	ninja -C build
}

check() {
	meson test -C build --no-rebeuild --print-errorlogs
}

package() {
	DESTDIR="$pkgdir" ninja -C build install
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" "$_archive/LICENSE"
}
